import pyecharts as pye
import random
bar1 = pye.charts.Bar()
bar1.add_xaxis(['张景红','张景绿','张景黑'])
bar1.add_yaxis("劳力",[random.randint(10,100),random.randint(10,100),random.randint(10,100)]
              ,label_opts=pye.options.LabelOpts(
                  position="right",
                  color="red"
              )
              )
bar1.reversal_axis()# 反转X和Y轴

bar2 = pye.charts.Bar()
bar2.add_xaxis(['张景红','张景绿','张景黑'])
bar2.add_yaxis("劳力",[random.randint(10,100),random.randint(10,100),random.randint(10,100)]
              ,label_opts=pye.options.LabelOpts(
                  position="right",
                  color="red"
              )
              )
bar2.reversal_axis()# 反转X和Y轴
timeline = pye.charts.Timeline()
timeline.add(bar1,"2022年")
timeline.add(bar2,"2023年")
timeline.render("柱状图-时间轴.html")